(defun palindromp (n &optional (pos (1- (floor (/ (length n) 2)))))
  (cond ((>= 1 (length n)) t)
	((> 0 pos) t)
	((equal (nth pos n) (nth (1- (- (length n) pos)) n)) (palindromp n (1- pos)))
	(t nil)))

(defun palindromp-str(string)
  (palindromp (loop for char across string collect char)))

(defun both-palind(i)
  (and (palindromp-str (with-output-to-string (stream) (format stream "~d" i)))
       (palindromp-str (with-output-to-string (stream) (format stream "~b" i)))))

(defun probl36()
  (loop for i from 1 to 1000000 when (both-palind i) sum i))
      